<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/Welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片内容 -->
    <el-card class="box-card">
      <!-- table内容 -->

      <el-table :data="rightsList" stripe style="width: 100%" border>
        <el-table-column type="index" width="50" label="#"> </el-table-column>
        <el-table-column prop="authName" label="权限名称" width="350">
        </el-table-column>
        <el-table-column prop="path" label="路径" width="300">
        </el-table-column>
        <el-table-column prop="address" label="权限等级">
          <template slot-scope="scope">
            <el-tag type="" v-if="scope.row.level === '0'"> 一级权限 </el-tag>
            <el-tag type="success" v-else-if="scope.row.level === '1'">
              二级权限
            </el-tag>
            <el-tag type="warning" v-if="scope.row.level === '2'">
              三级权限
            </el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
import http from '../util/http'
export default {
  data () {
    return {
      rightsList: []
    }
  },
  mounted () {
    // 获取来表达的数据
    this.rightList()
  },
  methods: {
    rightList () {
      http('rights/list').then((res) => {
        console.log(res.data.data)
        this.rightsList = res.data.data
      })
    }
  }
}
</script>
